| 1 |
import { r as rest, l as languages } from "../../index-C1_GGQ8y.js"; |
| 2 |
import { d as clikePunctuation } from "../../patterns-Cp3h1ylA.js"; |
| 3 |
var inside = { |
| 4 |
"format-spec": { |
| 5 |
pattern: /(:)[^(){}:]+(?=\}$)/, |
| 6 |
lookbehind: true |
| 7 |
}, |
| 8 |
"conversion-option": { |
| 9 |
pattern: //, |
| 10 |
alias: "punctuation" |
| 11 |
} |
| 12 |
}; |
| 13 |
inside[rest] = languages.py = languages.python = { |
| 14 |
"comment": { |
| 15 |
pattern: /#.*/g, |
| 16 |
greedy: true |
| 17 |
}, |
| 18 |
"string-interpolation": { |
| 19 |
pattern: /(?:fr?|rf)(?:("""|''')[^]*?\1|(["'])(?:\\[^]|(?!\2)[^\\\n])*\2)/gi, |
| 20 |
greedy: true, |
| 21 |
inside: { |
| 22 |
"interpolation": { |
| 23 |
// "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}" |
| 24 |
pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})*\}/, |
| 25 |
lookbehind: true, |
| 26 |
inside |
| 27 |
}, |
| 28 |
"string": /[^]+/ |
| 29 |
} |
| 30 |
}, |
| 31 |
"triple-quoted-string": { |
| 32 |
pattern: /(?:br?|rb?|u)?("""|''')[^]*?\1/gi, |
| 33 |
greedy: true, |
| 34 |
alias: "string" |
| 35 |
}, |
| 36 |
"string": { |
| 37 |
pattern: /(?:br?|rb?|u)?(["'])(?:\\[^]|(?!\1)[^\\\n])*\1/gi, |
| 38 |
greedy: true |
| 39 |
}, |
| 40 |
"function": { |
| 41 |
pattern: /((?:^|\s)def[ ]+)(?!\d)\w+(?=\s*\()/, |
| 42 |
lookbehind: true |
| 43 |
}, |
| 44 |
"class-name": { |
| 45 |
pattern: /(\bclass\s+)\w+/i, |
| 46 |
lookbehind: true |
| 47 |
}, |
| 48 |
"decorator": { |
| 49 |
pattern: /(^[ ]*)@\w+(?:\.\w+)*/m, |
| 50 |
lookbehind: true, |
| 51 |
alias: "annotation punctuation", |
| 52 |
inside: { |
| 53 |
"punctuation": /\./ |
| 54 |
} |
| 55 |
}, |
| 56 |
"keyword": /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|de[fl]|elif|else|except|exec|finally|f?or|from|global|i[fns]|import|lambda|match|nonlocal|not|pass|print|raise|return|try|while|with|yield)\b/, |
| 57 |
"builtin": /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|ma[px]|memoryview|min|next|object|oct|open|ord|pow|property|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|x?range|zip)\b/, |
| 58 |
"boolean": /\b(?:False|True|None)\b/, |
| 59 |
"number": /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f\d])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i, |
| 60 |
"operator": /!=|:=|\*\*=?|\/\/=?|<>|>>|<<|[%=<>/*+-]=?|[&|^~]/, |
| 61 |
"punctuation": clikePunctuation |
| 62 |
}; |
| 63 |
//# sourceMappingURL=python.js.map |